<?php

class Config {
	private static $_Config = array();
	// Get a value from $this->_config, if $required is passed as TRUE and value not defined, death occurs
	public static function Get($var_name, $default = NULL, $required = FALSE) {
		if ( isset(self::$_Config[$var_name]) ) {
			return self::$_Config[$var_name];
		} elseif ( !$required ) {
			return $default;
		} else {
			throw new RequiredConfigKeyNotSetException('Required configuration missing ' . $var_name);
		}
	} // Get()

	public static function Set($var_name, $var_value, $overwrite = TRUE) {
		if ( $overwrite ) {
			self::$_Config[$var_name] = $var_value;
		} else if ( !isset(self::$_Config[$var_name]) ) {
			self::$_Config[$var_name] = $var_value;
		}
	} // Set()
}

class RequiredConfigKeyNotSetException extends Exception { }